#include<stdio.h>
#include<fcntl.h>
#include<termios.h>
#include<unistd.h>
#include<errno.h>

int main()
{
    struct termios SerialPortSettings;
    int fd;
     fd = open("/dev/ttyUSB0", O_RDWR | O_TRUNC);
     if (fd == -1)
     printf("error");
     else
     {
         printf("success\n");
     }

     tcgetattr(fd, &SerialPortSettings);
     SerialPortSettings.c_cflag |= CREAD | CLOCAL;
     SerialPortSettings.c_cc[VMIN] = 10;
     SerialPortSettings.c_cc[VTIME] = 0;

     char read0[6] ;
     int a = read(fd, &read0, 6);
     printf("totally receive %d  bytes \n %s", a,read0);
     close(fd);
     return 0;
}